home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 323_01 / parser.h < prev    next >
C/C++ Source or Header  |  1990-08-04  |  1KB  |  50 lines

  1. /*--------------------------------------------------------------------------*\
  2. | PARSER.H                                                                   |
  3. \*--------------------------------------------------------------------------*/
  4.  
  5. /*
  6.    Adventure Parser
  7. */
  8.  
  9. #define v_sig 4               /* 1st 4 letters of vocab words significant */
  10.  
  11. #define max_cmd_size 64                /* at most 63 chars per command */
  12. #define max_cmd_len max_cmd_size-1
  13.  
  14. #define max_word_size 16               /* at most 15 chars per word in input */
  15. #define max_word_len max_word_size-1
  16.  
  17. typedef char v_cmd [max_cmd_size ];
  18. typedef char v_word [max_word_size ];  /* a vocabulary (normal) word */
  19.  
  20.  
  21. typedef struct        /* a command */
  22. {
  23.   v_cmd
  24.     cm;               /* command entered */
  25.  
  26.   v_word
  27.     verb,             /* verb part */
  28.     noun,             /* noun part */
  29.     sh_verb,          /* short form of verb and noun for comparison */
  30.     sh_noun;
  31.  
  32.   int
  33.     vn,               /* verb # in vocab */
  34.     nn;               /* noun # in vocab */
  35. }
  36. CmdRec;
  37.  
  38.  
  39. ParseCommand( char *cm, char *verb, char *noun );
  40. resize_word( char *s );
  41. int GetWordNum( char *w,   vocab_type *voc );
  42. int GetVerbNum( char *verb );
  43. int GetNounNum( char *noun );
  44. AnalyseCommand( CmdRec *cmd );
  45.  
  46.  
  47. extern
  48.   CmdRec cmd;
  49.  
  50.